package Operation;

import JavaBeans.*;


import java.util.Scanner;

public class AppendOperation implements IOperation{
    @Override
    public void operate(BookList bookList) {
        System.out.println("新增图书...");
        Scanner in = new Scanner(System.in);
        bookList.checkCapacities();

        System.out.print("书名：");
        String name = in.nextLine();
        System.out.print("作者：");
        String author = in.nextLine();
        System.out.print("价格：");
        double price = in.nextDouble();
        in.nextLine();//消除换行符
        System.out.print("类型：");
        String type = in.nextLine();

        bookList.setBook(bookList.getCurrentCount(),new Book(name,author,price,type));
        bookList.setCurrentCount(bookList.getCurrentCount() + 1);
        System.out.println("添加成功！");
    }
}
